package guoanmaker.operator.business.repository;

import guoanmaker.operator.business.model.OperatorCities;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 *  
 *
 * @author huZhaoyu 
 * @ClassName: OperatorCitiesRepository
 * @Description: 城市Repository
 * @date 2017/7/12
 */
public interface OperatorCitiesRepository extends JpaRepository<OperatorCities, String>, JpaSpecificationExecutor<OperatorCities> {
    //	@Query("select u from OperatorUser u left join fetch u.roles r where u.username=:username")
//    public Optional<OperatorUser> findByUsername(@Param("username") String username);
    Integer countAllByIdIsNotNull();

    List<OperatorCities> findAllByProvinceCode(String provinceCode);

    OperatorCities findByNameContaining(String name);
    @Query("select u from OperatorCities u  where u.code=:code")
    OperatorCities findByCode(@Param("code") String code);
}